@extends('admin._layouts.default')

<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/ueditor.config.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/ueditor.config.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/ueditor.all.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/lang/zh-cn/zh-cn.js') }}"></script>
@section('main')


      <div class="row-fluid ">
        <div class="span12 box gradient ">
      <div class="title">
            <div class="row-fluid">
                <h3><a class="btn btn-mini pull-right mg5"><i class="fa fa-hand-o-left"></i> 返回</a>
                  <i class="fa fa-cube"></i> 发布商品
                </h3>
            </div>
        </div><!-- End .title -->
        <div class="content">
            {{ Form::model($mount, array('method' => 'put', 'route' => array('admin.mounts.update', $mount->id),'files'=>true,'id'=>'mounts','class'=>'bs-docs-example form-horizontal')) }}
                <input type="hidden" name="from" value="{{ $from }}">
                 <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">装机姓名</label>
                    <div class="controls span2">
                      <div class="input-prepend row-fluid">
                        <span class="add-on prepend "><i class="fa fa-user "></i></span>
                        <input class="row-fluid" name="mount_name" value="{{ $mount->mount_name }}" id="cloth2" required  size="50" type="text" >
                      </div>
                    </div>
                  </div>
                 <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">装机电话</label>
                    <div class="controls span2">
                      <div class="input-prepend row-fluid">
                        <span class="add-on prepend "><i class="fa fa-mobile "></i></span>
                        <input class="row-fluid" name="mount_mobile" value="{{ $mount->mount_mobile }}" id="cloth2" required  size="50" type="text" >
                      </div>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">装机区域</label>

                    <div class="controls span2">
                      <div class="input-prepend row-fluid">
                        <select disabled class="inline-block" style="width: 150px;">
                           <option>{{ $mount->cityname->fatherinfo->name }}</option>
                       </select>
                       </div>
                    </div>
                    <div class="controls span2">
                      <div class="input-prepend row-fluid">
                        <select disabled class="inline-block" style="width: 150px;">
                           <option>{{ $mount->cityname->name }}</option>
                       </select>
                       </div>
                    </div>
                    <div class="controls span2">
                      <div class="input-prepend row-fluid">
                        <select name="section_id" class="inline-block" style="width: 150px;" onchange="select_items('select_section',this.options[this.options.selectedIndex].value)">
                            @foreach($sections as $section)
                               <option @if($section->id == $mount->section_id) selected @endif  value="{{ $section->id }}">{{ $section->name }}</option>
                            @endforeach
                       </select>
                       </div>
                    </div>
                    <div class="controls span2">
                      <div class="input-prepend row-fluid">
                        <select name="area_id" id="select_section" class="inline-block" style="width: 150px;">
                                @if($mount->area_id == 0)
                                <option selected >暂无</option>
                                @elseif($mount->xiaoqu->city_id == null)
                                <option selected >{{ $mount->xiaoqu->name }}</option>
                                @endif

                            @foreach($xiaoqus as $xiaoqu)
                               <option @if($xiaoqu->id == $mount->area_id) selected @endif  value="{{ $xiaoqu->id }}">{{ $xiaoqu->name }}</option>
                            @endforeach
                       </select>
                       </div>
                    </div>
                </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">详细地址</label>
                    <div class="controls span5">
                      <textarea id="text" rows="1" name="address" class="row-fluid">{{ $mount->address }}</textarea>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">安装日期</label>
                    <div class="controls span5">
                        <input class="row-fluid" name="create_time" id="cloth2" required value="{{ $mount->created_at }}"  size="50" type="text" >
                    </div>
                  </div>
                  <div class="form-actions row-fluid">
                    <div class="span10 offset3">
                      <button type="submit" class="btn btn-large btn-info"><i class="fa fa-save"></i> 立即保存</button>
                      <button type="button" class="btn btn-large"><i class="fa fa-hand-o-left"></i> 取消</button>
                    </div>
                  </div>
               {{ Form::close() }}




            </div>
        </div>
        <!-- End box -->
      </div>


@stop

@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/jquery.peity.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/jquery.uniform.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>

<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/flot/jquery.flot.js') }}"></script>



<script src="{{ URL::asset('web/js/scripts.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/jnavigate.jquery.min.js') }}"></script>
<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');

</script>
<script>

function select_items(item,id){
    var obj = $('#'+item);
    $.post('{{ route('admin.mounts.ajax') }}',{id : id , item : item},function(data){
        obj.html(data);
    });
}
</script>
<script type="text/javascript">

        var maxstrlen = 100;
        function Q(s) { return document.getElementById(s); }

        function checkWord(c) {
            len = maxstrlen;
            var str = c.value;
            myLen = getStrleng(str);
            var wck = Q("wordCheck");

            if (myLen > len * 2) {
                c.value = str.substring(0, i + 1);
            }
            else {
                wck.innerHTML = Math.floor((len * 2 - myLen) / 2);
            }
        }

        function getStrleng(str) {
            myLen = 0;
            i = 0;
            for (; (i < str.length) && (myLen <= maxstrlen * 2); i++) {
                if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128)
                    myLen++;
                else
                    myLen += 2;
            }
            return myLen;
        }
        function fabu(){
            $('#pages').submit();
        }
</script>
@stop
